package com.rmb.controller;

import com.rmb.annotation.SystemLog;
import com.rmb.common.model.response.CommonCode;
import com.rmb.common.model.response.ResponseResult;
import com.rmb.common.model.response.ResultCode;
import com.rmb.entity.TaskExcel;
import com.rmb.enums.LogType;
import com.rmb.service.TaskExcelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 吕栋 2021/01/10
 */
@RestController
@RequestMapping("/rmb/excel")
public class TaskExcelController {

    @Autowired
    private TaskExcelService taskExcelService;

    /**
     * 接收前台数据存入表中
     * @param taskExcel
     * @return
     */
    @PostMapping("saveExcel")
    @SystemLog(description = "添加Excel",type = LogType.INSERT)
    public ResponseResult saveExcel(@RequestBody TaskExcel taskExcel){
        return taskExcelService.saveExcel(taskExcel);
    }

    @GetMapping("/getAllExcel")
    @SystemLog(description = "查询Excel数据",type = LogType.SELETE)
    public List getAllExcel(){
        return taskExcelService.getAllExcel();
    }
    @GetMapping("/delExcel")
    @SystemLog(description = "删除Excel",type = LogType.DELETE)
    public ResponseResult delAll(){
       return taskExcelService.delAll();
    }


}
